package com.db.rome.monitoring.file;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * User: gryaale
 * Date: 8/8/14
 */
public class StatusFileReader {

    private static final String EOF_MARKER = "END_OF_FILE_MARKER";
//    private static final String NEW_LINE = "\r\n";

    public List<String> readFile(String file) {
//        StringBuilder result = new StringBuilder();
        List<String> result = new ArrayList<String>();
        try {
            BufferedReader reader = new BufferedReader(new FileReader(file));
            while (true) {
                String line = reader.readLine();
                if (EOF_MARKER.equals(line)) {
                    break;
                }
//                result.append(line);
                result.add(line);
//                result.append(NEW_LINE);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }
}
